//testing makerpn()

#include <iostream>
using namespace std;
void makerpn(); 


char ext []={63, 63, 63, 61, 43, 45, 42, 47, 65, 66,
				  67, 68, 69, 70, 71, 72, 73, 74, 75, 76,
				  77, 78, 79, 80, 81, 82, 83, 84, 85, 86,
				  87, 88, 89, 90, 97, 98, 99, 100,101,102,
				  103,104,105,106,107,108,109,110,111,112,
				  113,114,115,116,117,118,119,120,121,122},
				  str[241], stak[80], rpn[241];


char inform[]={34,3,35,4,37,'\0'};//a=b+c

int main(){
	char *z, *y;
	z=rpn;
	y=rpn;
		while(*z!='\0'){
			cout<<*z<<" ";
			z++;
		}
		
		makerpn();


		while(*y!='\0'){
			cout<<(int)*y<<" ";
			y++;
		}
cout<<"\n\nDone!"; 

return 0;
}


void makerpn(){

static char pr[] = { 0,0,1,2,3,3,4,4};
char n, *p, *r, s, *t;
cout<<"\nRPN form:\n\n";
t=stak-1;
r=rpn;
p=&inform[0];

for(p; *p!='\0'; p++){
			if(7<(s=*p)){
				*r++=s;
				continue;
			}
			else{
				if(s==1){
					*++t=s;
					continue; 
				}
				else{
					while(true){
						if(t<stak){
							*++t=s;
							break;
						}
						else{
							if(pr[s]<=pr[n=*t--]){
								*r++=n;
								continue;
							}
							else{
								if(3<n+s){
									*++t=n;
									*++t=s;
								}
								break;
					        }
						}
					}
				}
            }
	}
while(stak<=t){
			*r++=*t--;
	}
	
	*r='\0';
	
	for(r=rpn; *r!='\0'; r++){
		cout<<ext[(int)*r];
	}
	cout<<"\n\n";
}
	
		